package com.panda.command;


import java.nio.charset.Charset;
import java.util.List;

//一个操作可能由多个参数组成
abstract class Operation {

    private Operation next;

    Operation next(Operation operation) {
        this.next = operation;
        return operation;
    }


    abstract boolean canHandle(String ope);

    abstract void doHandle(String ope, List<String> args) throws Exception;

    void handle(String ope, List<String> args) throws Exception{

        if (this.canHandle(ope)) {
            doHandle(ope, args);
        } else {

            if (next != null) {
                next.handle(ope, args);
            }

        }

    }


}
